﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp4
{
    public class dBHelper
    {
        private readonly static string conStr="server=.;database=Adimi;uid=sa;pwd=123456;";

        public static SqlDataReader Select(string cmdStr)
        {
            SqlConnection connection = new SqlConnection(conStr);

            connection.Open();

            SqlCommand cmd = new SqlCommand(cmdStr,connection);
            
            return cmd.ExecuteReader();
        }
        
        public static DataTable GetDataTable(string cmdStr)
        {
            SqlConnection connection = new SqlConnection(conStr);

            SqlDataAdapter sqlData = new SqlDataAdapter(cmdStr,connection);

            DataTable dt = new DataTable();

            connection.Open();

            sqlData.Fill(dt);

            return dt;
        }

    }
}
